package GUI;


import Agent.TravelAgent;
import OntologyCreditCard.Address;
import OntologyCreditCard.BelongsTo;
import OntologyCreditCard.CreditCard;
import OntologyCreditCard.Person;
import jade.core.AID;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Stack;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import message.msgFlightAvailability_Result_List;
import message.msgReqFlightAvailability;
import org.jdesktop.application.Action;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TravelAgentGUI.java
 *
 * Created on Oct 23, 2011, 4:12:19 PM
 */
/**
 *
 * @author henry
 */
public class TravelAgentGUI extends javax.swing.JFrame {
    
    private msgReqFlightAvailability msgReqFlightAva;
    private TravelAgent travelA;
    
    /** Creates new form TravelAgentGUI */
    public TravelAgentGUI(TravelAgent a) {
        super(a.getLocalName());
        travelA = a;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        txtOrigin_City = new javax.swing.JTextField();
        txtOrigin_Country = new javax.swing.JTextField();
        txtDestination_City = new javax.swing.JTextField();
        txtDestination_Country = new javax.swing.JTextField();
        txtOnWard_Date = new javax.swing.JTextField();
        txtReturn_Date = new javax.swing.JTextField();
        txtNo_Of_Passengers = new javax.swing.JTextField();
        txtBudget = new javax.swing.JTextField();
        btnReqFlightDetails = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblAvaFlights = new javax.swing.JTable();
        btnSelectFlight = new javax.swing.JButton();
        lblCustName = new javax.swing.JLabel();
        txtCustName = new javax.swing.JTextField();
        lblAddBlkNo = new javax.swing.JLabel();
        txtAddBlkNo = new javax.swing.JTextField();
        lblAddStName = new javax.swing.JLabel();
        txtAddStreet = new javax.swing.JTextField();
        lblAddUnit = new javax.swing.JLabel();
        txtAddUnit = new javax.swing.JTextField();
        lblAddPostal = new javax.swing.JLabel();
        txtAddPostal = new javax.swing.JTextField();
        lblCCType = new javax.swing.JLabel();
        txtCCType = new javax.swing.JTextField();
        lblCCNo = new javax.swing.JLabel();
        txtCCNo = new javax.swing.JTextField();
        btnMakePayment = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(jade_project.Jade_ProjectApp.class).getContext().getResourceMap(TravelAgentGUI.class);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        txtOrigin_City.setText(resourceMap.getString("txtOrigin_City.text")); // NOI18N
        txtOrigin_City.setName("txtOrigin_City"); // NOI18N

        txtOrigin_Country.setText(resourceMap.getString("txtOrigin_Country.text")); // NOI18N
        txtOrigin_Country.setName("txtOrigin_Country"); // NOI18N

        txtDestination_City.setText(resourceMap.getString("txtDestination_City.text")); // NOI18N
        txtDestination_City.setName("txtDestination_City"); // NOI18N

        txtDestination_Country.setText(resourceMap.getString("txtDestination_Country.text")); // NOI18N
        txtDestination_Country.setName("txtDestination_Country"); // NOI18N

        txtOnWard_Date.setText(resourceMap.getString("txtOnWard_Date.text")); // NOI18N
        txtOnWard_Date.setName("txtOnWard_Date"); // NOI18N

        txtReturn_Date.setText(resourceMap.getString("txtReturn_Date.text")); // NOI18N
        txtReturn_Date.setName("txtReturn_Date"); // NOI18N

        txtNo_Of_Passengers.setText(resourceMap.getString("txtNo_Of_Passengers.text")); // NOI18N
        txtNo_Of_Passengers.setName("txtNo_Of_Passengers"); // NOI18N

        txtBudget.setText(resourceMap.getString("txtBudget.text")); // NOI18N
        txtBudget.setName("txtBudget"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(jade_project.Jade_ProjectApp.class).getContext().getActionMap(TravelAgentGUI.class, this);
        btnReqFlightDetails.setAction(actionMap.get("reqFlightDetails")); // NOI18N
        btnReqFlightDetails.setText(resourceMap.getString("btnReqFlightDetails.text")); // NOI18N
        btnReqFlightDetails.setName("btnReqFlightDetails"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        tblAvaFlights.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Airline", "FlightNo", "Departure City", "Departure Time", "Arrival City", "Arrival Time"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tblAvaFlights.setName("tblAvaFlights"); // NOI18N
        jScrollPane1.setViewportView(tblAvaFlights);
        tblAvaFlights.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("tblAvaFlights.columnModel.title0")); // NOI18N
        tblAvaFlights.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("tblAvaFlights.columnModel.title1")); // NOI18N
        tblAvaFlights.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("tblAvaFlights.columnModel.title2")); // NOI18N
        tblAvaFlights.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("tblAvaFlights.columnModel.title3")); // NOI18N
        tblAvaFlights.getColumnModel().getColumn(4).setHeaderValue(resourceMap.getString("tblAvaFlights.columnModel.title4")); // NOI18N
        tblAvaFlights.getColumnModel().getColumn(5).setHeaderValue(resourceMap.getString("tblAvaFlights.columnModel.title5")); // NOI18N

        btnSelectFlight.setAction(actionMap.get("selectFlight")); // NOI18N
        btnSelectFlight.setText(resourceMap.getString("btnSelectFlight.text")); // NOI18N
        btnSelectFlight.setName("btnSelectFlight"); // NOI18N

        lblCustName.setText(resourceMap.getString("lblCustName.text")); // NOI18N
        lblCustName.setName("lblCustName"); // NOI18N

        txtCustName.setText(resourceMap.getString("txtCustName.text")); // NOI18N
        txtCustName.setName("txtCustName"); // NOI18N

        lblAddBlkNo.setText(resourceMap.getString("lblAddBlkNo.text")); // NOI18N
        lblAddBlkNo.setName("lblAddBlkNo"); // NOI18N

        txtAddBlkNo.setText(resourceMap.getString("txtAddBlkNo.text")); // NOI18N
        txtAddBlkNo.setName("txtAddBlkNo"); // NOI18N

        lblAddStName.setText(resourceMap.getString("lblAddStName.text")); // NOI18N
        lblAddStName.setName("lblAddStName"); // NOI18N

        txtAddStreet.setText(resourceMap.getString("txtAddStreet.text")); // NOI18N
        txtAddStreet.setName("txtAddStreet"); // NOI18N

        lblAddUnit.setText(resourceMap.getString("lblAddUnit.text")); // NOI18N
        lblAddUnit.setName("lblAddUnit"); // NOI18N

        txtAddUnit.setText(resourceMap.getString("txtAddUnit.text")); // NOI18N
        txtAddUnit.setName("txtAddUnit"); // NOI18N

        lblAddPostal.setText(resourceMap.getString("lblAddPostal.text")); // NOI18N
        lblAddPostal.setName("lblAddPostal"); // NOI18N

        txtAddPostal.setText(resourceMap.getString("txtAddPostal.text")); // NOI18N
        txtAddPostal.setName("txtAddPostal"); // NOI18N

        lblCCType.setText(resourceMap.getString("lblCCType.text")); // NOI18N
        lblCCType.setName("lblCCType"); // NOI18N

        txtCCType.setText(resourceMap.getString("txtCCType.text")); // NOI18N
        txtCCType.setName("txtCCType"); // NOI18N

        lblCCNo.setText(resourceMap.getString("lblCCNo.text")); // NOI18N
        lblCCNo.setName("lblCCNo"); // NOI18N

        txtCCNo.setText(resourceMap.getString("txtCCNo.text")); // NOI18N
        txtCCNo.setName("txtCCNo"); // NOI18N

        btnMakePayment.setAction(actionMap.get("makeCCPayment")); // NOI18N
        btnMakePayment.setText(resourceMap.getString("btnMakePayment.text")); // NOI18N
        btnMakePayment.setActionCommand(resourceMap.getString("btnMakePayment.actionCommand")); // NOI18N
        btnMakePayment.setName("btnMakePayment"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(btnMakePayment, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblCustName)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(25, 25, 25)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jLabel2)
                                        .addComponent(jLabel1)))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel8)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel6)
                                        .addComponent(jLabel5))
                                    .addComponent(jLabel7)))
                            .addComponent(lblAddBlkNo)
                            .addComponent(lblAddStName)
                            .addComponent(lblAddUnit)
                            .addComponent(lblAddPostal)
                            .addComponent(lblCCType)
                            .addComponent(lblCCNo))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(txtCCNo, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtCCType, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtAddPostal, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtAddUnit, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtAddStreet, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtAddBlkNo, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtCustName)
                            .addComponent(txtOnWard_Date, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                            .addComponent(txtDestination_Country, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                            .addComponent(txtBudget, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                            .addComponent(txtNo_Of_Passengers, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                            .addComponent(txtReturn_Date, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                            .addComponent(btnReqFlightDetails)
                            .addComponent(txtOrigin_City, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                            .addComponent(txtOrigin_Country, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                            .addComponent(txtDestination_City, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE))))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 501, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(428, 428, 428)
                        .addComponent(btnSelectFlight)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 273, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(txtOrigin_City, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtOrigin_Country, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(txtDestination_City, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(11, 11, 11)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(txtDestination_Country, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(16, 16, 16)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(txtOnWard_Date, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6)
                            .addComponent(txtReturn_Date, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(11, 11, 11)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(txtNo_Of_Passengers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(txtBudget, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnReqFlightDetails)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSelectFlight))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblCustName)
                            .addComponent(txtCustName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtAddBlkNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblAddBlkNo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtAddStreet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblAddStName))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtAddUnit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblAddUnit))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtAddPostal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblAddPostal))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCCType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCCType))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCCNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCCNo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnMakePayment)
                .addContainerGap(63, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void showGUI(){
        pack();
        super.setVisible(true);
    }

    @Action
    public void reqFlightDetails() {
        //11-June-2011
        //for Jade
        //set up the message first
        msgReqFlightAvailability reqFlightAva = new msgReqFlightAvailability();
        reqFlightAva.setOrigin_City(txtOrigin_City.getText());
        reqFlightAva.setOrigin_Country(txtOrigin_Country.getText());
        reqFlightAva.setDestination_City(txtDestination_City.getText());
        reqFlightAva.setDestination_Country(txtDestination_Country.getText());
        reqFlightAva.setOnWard_Date(convertStringToDate(txtOnWard_Date.getText()));
        reqFlightAva.setReturn_Date(convertStringToDate(txtReturn_Date.getText()));
        reqFlightAva.setNo_Of_Traveller(Integer.valueOf(txtNo_Of_Passengers.getText()));
        reqFlightAva.setBudget(Integer.valueOf(txtBudget.getText()));
        
        travelA.getFlightDetails(reqFlightAva);
        
        //currently for events, 1 = getFlightAvailability
        //GuiEvent geGetFlightAvailability = new GuiEvent(this, 1); 
    
    
    }
    
    //utility function for conversion from string to Date
    public Date convertStringToDate(String sValue){
        //"11-June-07"
        DateFormat formatter ; 
        Date date = new Date(); 
        
        try{
            formatter = new SimpleDateFormat("dd-MMM-yy");
            date = (Date)formatter.parse(sValue);
        }
        catch(Exception ex){
            
        }
        
        return date;
    }
    
    public void notifyUser(String message) {
        JOptionPane.showMessageDialog (null, message);
    }
    
    public void displayAvaFlights(msgFlightAvailability_Result_List input){
        Vector<String> header = new Stack<String>();
        
        header.add(null);
        header.add("Airline");
        header.add("FlightNo");
        header.add("Departure City");
        header.add("Departure Date");
        header.add("Arrival City");
        header.add("Arrival Date");

        Vector<Vector<String>> vColList = new Vector<Vector<String>>();

        for(int i = 0; i < input.getSize(); i++){
            Vector<String> col = new Vector<String>();
            col.add(input.getByIndex(i).getAirliner()); 
            col.add(input.getByIndex(i).getFlightID());
            col.add(input.getByIndex(i).getDeparture_City());
            col.add(input.getByIndex(i).getDepartureDate().toString());
            col.add(input.getByIndex(i).getDestination_City());
            col.add(input.getByIndex(i).getArrivalDate().toString());
            vColList.add(col);
        }
        
        tblAvaFlights = new JTable(vColList, header);
        
    }

    @Action
    public void selectFlight() {
        travelA.bookFlight("Request1", new AID());
    }

    @Action
    public void makeCCPayment() {
        
        Person p = new Person();
        Address add = new Address();
        CreditCard card = new CreditCard();
        
        p.setName(txtCustName.getText());
        
        add.SetBlockNumber(txtAddBlkNo.getText());
        add.SetPostalCode(txtAddPostal.getText());
        add.SetStreetName(txtAddStreet.getText());
        add.SetUnitNumber(txtAddUnit.getText());
        p.setAddress(add);
        
        card.SetCardNumber(txtCCNo.getText());
        card.SetCardType(txtCCType.getText());

        BelongsTo bt = new BelongsTo();
        bt.SetPerson(p);
        bt.setCreditCard(card);
        
        travelA.makeCCPayment(bt);
        
        
    }
        
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnMakePayment;
    private javax.swing.JButton btnReqFlightDetails;
    private javax.swing.JButton btnSelectFlight;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblAddBlkNo;
    private javax.swing.JLabel lblAddPostal;
    private javax.swing.JLabel lblAddStName;
    private javax.swing.JLabel lblAddUnit;
    private javax.swing.JLabel lblCCNo;
    private javax.swing.JLabel lblCCType;
    private javax.swing.JLabel lblCustName;
    private javax.swing.JTable tblAvaFlights;
    private javax.swing.JTextField txtAddBlkNo;
    private javax.swing.JTextField txtAddPostal;
    private javax.swing.JTextField txtAddStreet;
    private javax.swing.JTextField txtAddUnit;
    private javax.swing.JTextField txtBudget;
    private javax.swing.JTextField txtCCNo;
    private javax.swing.JTextField txtCCType;
    private javax.swing.JTextField txtCustName;
    private javax.swing.JTextField txtDestination_City;
    private javax.swing.JTextField txtDestination_Country;
    private javax.swing.JTextField txtNo_Of_Passengers;
    private javax.swing.JTextField txtOnWard_Date;
    private javax.swing.JTextField txtOrigin_City;
    private javax.swing.JTextField txtOrigin_Country;
    private javax.swing.JTextField txtReturn_Date;
    // End of variables declaration//GEN-END:variables
}
